package cn.tedu.medicalappointmentsystemk.dao.persist.repository.impl;

import cn.tedu.medicalappointmentsystemk.dao.persist.mapper.DoctorMapper;
import cn.tedu.medicalappointmentsystemk.dao.persist.repository.DoctorRepository;
import cn.tedu.medicalappointmentsystemk.pojo.bo.DoctorSelectBO;
import cn.tedu.medicalappointmentsystemk.pojo.bo.DoctorSelectByDoctorIdBO;
import cn.tedu.medicalappointmentsystemk.pojo.param.DoctorUpdateParam;
import cn.tedu.medicalappointmentsystemk.pojo.po.DoctorPO;
import com.github.pagehelper.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;


@Repository
public class DoctorRepositoryImpl implements DoctorRepository {
    @Autowired
    DoctorMapper doctorMapper;

    @Override
    public Integer addNew(DoctorPO po) {
        return doctorMapper.insert(po);
    }

    @Override
    public Page<DoctorSelectBO> select() {
        return doctorMapper.select();
    }

    @Override
    public DoctorPO selectById(Long id) {
        return doctorMapper.selectById(id);
    }

    @Override
    public Integer deleteById(Long id) {
        return doctorMapper.deleteById(id);
    }

    @Override
    public Integer update(DoctorUpdateParam param) {
        return doctorMapper.update(param);
    }

    @Override
    public Long selectIdByUserId(Long userId) {
        return doctorMapper.selectIdByUserId(userId);
    }

    @Override
    public DoctorSelectByDoctorIdBO selectDoctorByDoctorId(Long id) {
        return doctorMapper.selectDoctorByDoctorId(id);
    }

    @Override
    public List<DoctorSelectBO> selectByNickname(String nickname) {
        return doctorMapper.selectByNickname(nickname);
    }

    @Override
    public Integer selectTotal() {
        return doctorMapper.selectCount(null);
    }

    @Override
    public Page<DoctorSelectBO> searchLastWeek() {
        return doctorMapper.searchLastWeek();
    }

    @Override
    public Page<DoctorSelectBO> searchLastMonth() {
        return doctorMapper.searchLastMonth();
    }

    @Override
    public Page<DoctorSelectBO> searchToday() {
        return doctorMapper.searchToday();
    }
}
